<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('task_files', function (Blueprint $table) {
            $table->id();
            $table->unsignedTinyInteger('type')->comment('文件类型 1:图片 2:视频');
            $table->unsignedInteger('task_id')->comment('任务主键')->index();
            $table->unsignedInteger('papper_id')->comment('文案主键')->index();
            $table->string('path', 255)->comment('文件路径');
            $table->unsignedSmallInteger('sort')->default(50)->comment('数据排序（升序）');
            $table->timestamp('created_at')->comment('数据创建时间')->default(DB::raw('CURRENT_TIMESTAMP'));
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('task_files');
    }
};
